﻿Imports System
Imports System.Collections.Generic
Imports System.Reflection

Namespace System.Workflow.ComponentModel.Design
    <DefaultMember("Item")> _
    Public NotInheritable Class ActivityDesignerGlyphCollection
        Inherits List([Of] DesignerGlyph)
        ' Methods
        Public Sub New()
        End Sub

        Public Sub New(ByVal glyphs As IEnumerable([Of] DesignerGlyph))
            MyBase.New(glyphs)
        End Sub

        Public Sub New(ByVal glyphs As ActivityDesignerGlyphCollection)
            MyBase.New(glyphs)
        End Sub


        ' Properties
        Friend ReadOnly Default Property Item(ByVal type As Type) As DesignerGlyph
            Get
                If (type Is Nothing) Then
                    Throw New ArgumentNullException
                End If
                Dim glyph As DesignerGlyph = Nothing
                Dim glyph2 As DesignerGlyph
                For Each glyph2 In Me
                    If (glyph2.GetType Is type) Then
                        Return glyph2
                    End If
                    If (type.IsAssignableFrom(glyph2.GetType) AndAlso (glyph Is Nothing)) Then
                        glyph = glyph2
                    End If
                Next
                Return glyph
            End Get
        End Property

    End Class
End Namespace

